package com.example.controller;

import com.alibaba.fastjson2.JSON;
import com.example.common.Add;
import com.example.common.Update;
import com.example.entity.Person;
import lombok.extern.slf4j.Slf4j;
import org.springframework.validation.annotation.Validated;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

@Slf4j
@RestController
public class PersonController {
    @RequestMapping("insertUser")
    public String insertUser(@RequestBody @Validated({Add.class}) Person person){
        System.out.println(JSON.toJSONString(person));
        return "ok11";
    }

    @RequestMapping("updateUser")
    public String updateUser(@RequestBody @Validated(Update.class) Person person){
        System.out.println(JSON.toJSONString(person));
        return "ok";
    }
}
